<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Support\Facades\Response;

class CustomException extends Exception
{
    /**
     * 转换异常为 HTTP 响应
     *
     * @param  \Illuminate\Http\Request
     * @return \Illuminate\Http\Response
     */
    public function render($request)
    {
        return  Response::json([
            'code' => 1,
            'message' => $this->getMessage(),
        ], 200);
    }
}
